# 猜数字小游戏
# import random

# class Game:
#     def __init__(self):
#         self.target_number = random.randint(1, 100)
#         self.max_attempts = 10

#     def start(self):
#         print("欢迎来到猜数字游戏! 你有10次机会猜一个1到100之间的数字。")

#         for attempt in range(1, self.max_attempts + 1):
#             guess = int(input(f"第{attempt}次猜测: "))

#             if guess < self.target_number:
#                 print("猜小了")
#             elif guess > self.target_number:
#                 print("猜大了")
#             else:
#                 print(f"猜对了！你猜对了数字 {self.target_number}，游戏结束。")
#                 break
#         else:
#             print(f"游戏结束，没有猜到。正确的数字是 {self.target_number}。")

# game = Game()
# game.start()

# 2、剪刀石头布
# score=100
# import random
# while True:
#     compu = random.randint(1, 3)
#     me = int(input('请出拳:1-剪刀,2-石头,3-布: '))
#     if 0<me<4:
#         if ((me == 1) and (compu == 3)) or ((me == 2) and (compu == 1)) or ((me == 3) and (compu == 2)):
#             score+=10
#             print('赢啦,当前分数',score)
#         elif me == compu:
#             score +=0
#             print('平局,当前分数',score)
#         else:
#             score-=10
#             print('输啦,当前分数',score)
#         if score>=200:
#             print('游戏结束,比赛赢了')
#             break
#         if score<=0:
#             print('游戏结束,比赛输了')
#             break
#         else:
#             print('请输入正确的')

# 3、封装函数: 判断一个数组是对称数组? (函数说明文档也要写)
# 为什么不显示出来？？？？？？？？？？？？？？？？？？？？？？？？？
def a(arr):
    """获取长度 长度砍一半 循环前半部分 一前一后 判断是否为对称 不对称返回False 对称返回True"""
    length=len(arr)
    ban=length //2
    for i in range(ban):
        if arr[i]!=arr[length-i-1]:
            return False
    return True
arr=[1,2,3,4,5,6,6]
print(a(arr))


# 4、找出列表 a=[“hello”，“world”，“yoyo”，“congratulations”]中单词最长的一个
# a = ["hello","world","yoyo","congratulations"]
# b = max(a,key=len)
# print(b)
